<template>
  <transition
    enter-active-class="animate__animated animate__bounce"
    leave-active-class="animate__animated animate__heartBeat"
  >
    <div class="mask" v-if="visible">
      <div class="wrap">
        <div class="tip">
          <slot name="tip">
            <h2>提示</h2>
          </slot>
        </div>
        <div class="content">
          <slot name="body"> 确定要花费20000$吗？ </slot>
        </div>
        <div class="button">
          <button class="mask__button--success" @click="confirm">确定</button>
          <button class="mask__button--cancel" @click="cancel">取消</button>
        </div>
      </div>
    </div>
  </transition>
</template>
<script>
import "animate.css";
export default {
  props: {
    visible: {
      type: Boolean,
      default: () => false,
    },
  },
  methods: {
    confirm() {
      this.$emit("on-confirm");
    },
    cancel() {
      this.$emit("on-cancel");
    },
  },
};
</script>
<style scoped>
.mask {
  position: fixed;
  background: rgba(0, 0, 0, 0.4);
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

.wrap {
  background-color: #fff;
  border-radius: 10px;
  width: 350px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

.tip,
content,
.button {
  margin: 50px 0;
}

.button {
  display: flex;
  justify-content: space-between;
}

.mask__button--success {
  outline: none;
  border: 0;
  width: 100px;
  height: 40px;
  background: linear-gradient(90deg, #1596fb, #002dff);
  border-radius: 0.28571429rem;
  display: block;
  color: #fff;
  cursor: pointer;
  margin-right: 20px;
}

.mask__button--cancel {
  outline: none;
  border: 0;
  width: 100px;
  height: 40px;
  background: linear-gradient(90deg, #fb1515, #c1579e);
  border-radius: 0.28571429rem;
  display: block;
  color: #fff;
  cursor: pointer;
}
h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  padding: 0;
}
</style>
